<template>
  <div style="padding: 16px;">
    <h2>体校类别</h2>
    <div
      style="background: #F3F3F3; width: 100%;height: 40px;line-height: 40px;display: flex;justify-content: space-between;padding: 0 12px;"
    >
      <div style="font-size: 12px;">全省体校数量/所</div>
      <div style="font-size: 18px;color: #0F0F0F;">3628</div>
      <div style="width:400px;height:400px;" id="aa"></div>
    </div>
  </div>
</template>

<script>
import * as echarts from "echarts";

export default {
  name: "SchoolType",
  data() {
    return {
      chartInstance: null
    };
  },
  mounted() {
    this.datalist();
  },

  methods: {
    datalist() {
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById("aa"));
      // 指定图表的配置项和数据
      var option;

      // option = {
      //   tooltip: {
      //     trigger: "item"
      //   },
      //   legend: {
      //     top: "5%",
      //     left: "center"
      //   },
      //   series: [
      //     {
      //       name: "Access From",
      //       type: "pie",
      //       radius: ["40%", "70%"],
      //       center: ["50%", "70%"],
      //       // adjust the start and end angle
      //       startAngle: 180,
      //       endAngle: 360,
      //       data: [
      //         { value: 1048, name: "Search Engine" },
      //         { value: 735, name: "Direct" },
      //         { value: 580, name: "Email" },
      //         { value: 484, name: "Union Ads" },
      //         { value: 300, name: "Video Ads" }
      //       ]
      //     }
      //   ]
      // };

      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);

      // 监听父元素大小变化 刷新图表
      var ro = new ResizeObserver(entries => {
        for (let entry of entries) {
          const cr = entry.contentRect;
          myChart.resize();
        }
      });

      ro.observe(cc);
    }
  }
};
</script>

<style scoped>
h2 {
  margin-bottom: 20px;
}
</style>
